package com.luo.ai.assistant.etl;

import org.springframework.ai.document.Document;
import org.springframework.ai.document.DocumentReader;

import java.util.List;
import java.util.Map;

/**
 * 文档读取器
 *
 * @author luohq
 * @date 2025-01-01 15:24
 */
public interface MyDocumentReader extends DocumentReader {

    /**
     * Metadata associated with all documents created by the loader.
     * <p>
     * <font color="red">注：目前仅支持Text/Markdown设置元数据</font>
     * </p>
     *
     * @return Metadata to be assigned to the output Documents.
     */
    Map<String, Object> getCustomMetadata();

    /**
     * Read JSON documents.
     *
     * @return List of Documents.
     * @see <a href="https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_json">https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_json</a>
     */
    List<Document> readJson(String... jsonKeysToUse);

    /**
     * Read text documents.
     *
     * @return List of Documents.
     * @see <a href="https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_text">https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_text</a>
     */
    List<Document> readText();

    /**
     * Read Markdown documents.
     *
     * @return List of Documents.
     * @see <a href="https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_markdown">https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_markdown</a>
     */
    List<Document> readMarkdown();

    /**
     * Read PDF documents Auto Detect.
     *
     * @return List of Documents.
     */
    List<Document> readPdfAutoDetect();

    /**
     * Read PDF documents (One Pages to One Document).
     *
     * @return List of Documents.
     * @see <a href="https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_pdf_page">https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_pdf_page</a>
     */
    List<Document> readPdfPages();

    /**
     * Read PDF documents (Split Documents By Catalog).
     *
     * @return List of Documents.
     * @see <a href="https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_pdf_paragraph">https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_pdf_paragraph</a>
     */
    List<Document> readPdfByCatalog();

    /**
     * Read Offices documents (using Apache Tika).
     *
     * @return List of Documents.
     * @see <a href="https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_tika_docx_pptx_html">https://docs.spring.io/spring-ai/reference/api/etl-pipeline.html#_tika_docx_pptx_html</a>
     */
    List<Document> readOffice();
}
